/**
 * 用户路由
 */
const express = require('express')
const router = express.Router()
const expressJoi = require('@escook/express-joi')

// {}语法要求接收的变量和exports的变量名字相同，否则返回undefined，这相当于一个解包操作
const reg_user_scheam = require('../schema/user') 
const user_handler = require('../routers_handler/user_handler')

// console.log('reg_user_scheam:', reg_user_scheam)
// 注册路由
// router.post('/register', user_handler.register_user)
router.post('/register', expressJoi(reg_user_scheam.register_or_login), user_handler.register_user)

// 登陆路由
router.post('/login', expressJoi(reg_user_scheam.register_or_login), user_handler.login_user)


module.exports = router